package cn.fenqing.test;

public class Main3 {

    public static void main(String[] args) throws NoSuchMethodException {
        long start = System.nanoTime();
        String a = "";
        for (int i = 0; i < 10000; i++) {
            a += i;
        }
        long end = System.nanoTime();
        System.out.println("循环拼接" + (end - start));
        start = System.nanoTime();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 10000; i++) {
            sb.append(i);
        }
        String b = sb.toString();
        end = System.nanoTime();
        System.out.println("StringBuilder,append拼接" + (end - start));
    }

}